
const TOKEN_NAME = 'token'
// 1. 保存
export const saveToken = (tokenObj,user_phone,nickname) => {
  localStorage.setItem(TOKEN_NAME, JSON.stringify(tokenObj))  
  localStorage.setItem('user_phone',user_phone)
  localStorage.setItem('nickename',nickname)
}
 
// 2. 获取
export const getToken = () => {
  return JSON.parse(localStorage.getItem(TOKEN_NAME))
}
 
// 3. 删除
export const delToken = () => {
  localStorage.removeItem(TOKEN_NAME)
  localStorage.removeItem('user_phone')
  localStorage.removeItem('nickename')
}

export const userPhone = () => {
  return localStorage.getItem('user_phone')
}

export const userNickname = () => {
  return localStorage.getItem('nickename')
}

